﻿using System.Collections.Generic;
using UnityEngine;

public class PlayerAttack : MonoBehaviour
{
    public List<EnemyControl> DetectedList;
    public List<EnemyControl> AttackedList;
    [RegisterProperty("PlayerAttack")]
    public float damage;
    [RegisterProperty("PlayerAttack")]
    public float stun;
    [RegisterProperty("PlayerAttack")]
    public float knockback;

    private void Awake()
    {
        DetectedList = new List<EnemyControl>();
        AttackedList = new List<EnemyControl>();
    }

    private void OnTriggerEnter2D(Collider2D collision)
    {
        if(collision.transform.GetComponent<EnemyControl>()!=null)
        {
            DetectedList.Add(collision.transform.GetComponent<EnemyControl>());
            //Debug.Log("怪物进入");
        }
    }

    private void OnTriggerExit2D(Collider2D collision)
    {
        if (collision.transform.GetComponent<EnemyControl>() != null)
        {
            DetectedList.Remove(collision.transform.GetComponent<EnemyControl>());
            //Debug.Log("怪物退出");
        }
    }
}
